﻿using PmSoft.Core.Domain.Auth;
using PmSoft.Core.Domain.Entities;
using PmSoft.Core.Domain.Entities.Caching;
using PmSoft.Data.Abstractions.Attributes;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations.Schema;


namespace Demo.Domains.Entities.Sys;

/// <summary>
/// 系统菜单信息
///</summary>
[Table("sys_menu")]
[CacheSetting(true)]
[Description("系统菜单信息")]
[Auditable("sys")]
public class SysMenu : Entity<int>, IMenu
{
	/// <summary>
	/// 菜单ID
	/// </summary>
	[PrimaryKey("id")]
	public override int Id { get; set; }
	/// <summary>
	/// 路由的名称,该名称必须唯一，用于标识路由，例如在命名路由导航中使用 
	///</summary>
	[Column("name")]
	public string Name { get; set; }
	/// <summary>
	/// 标题名称 
	///</summary>
	[Column("title")]
	public string Title { get; set; }
	/// <summary>
	/// 权限编码
	/// </summary>
	[Column("perm_code")]
	public string PermCode { get; set; }
	/// <summary>
	/// 租户类型 
	///</summary>
	[Column("tenant_type")]
	public byte TenantType { get; set; }
	/// <summary>
	/// 父级ID 
	///</summary>
	[Column("parent_id")]
	public int? ParentId { get; set; }
	/// <summary>
	/// 菜单类型 
	///</summary>
	[Column("type")]
	public MenuType Type { get; set; }
	/// <summary>
	/// 前端路由的路径 
	///</summary>
	[Column("path")]
	public string? Path { get; set; }
	/// <summary>
	/// 路由的别名，以是单个字符串或字符串数组 
	///</summary>
	[Column("alias")]
	public string? Alias { get; set; }
	/// <summary>
	/// 路由的重定向目标 
	///</summary>
	[Column("redirect")]
	public string? Redirect { get; set; }
	/// <summary>
	/// 外链-跳转路径 
	///</summary>
	[Column("link")]
	public string? Link { get; set; }
	/// <summary>
	/// 前端组件 
	///</summary>
	[Column("component")]
	public string Component { get; set; }
	/// <summary>
	/// 路由在菜单中不展现 
	///</summary>
	[Column("is_hide")]
	public bool? IsHide { get; set; }
	/// <summary>
	/// 在新窗口打开 
	///</summary>
	[Column("open_new_window")]
	public bool? OpenNewWindow { get; set; }
	/// <summary>
	/// 当前路由在标签页不展现 
	///</summary>
	[Column("hide_tab")]
	public bool? HideTab { get; set; }
	/// <summary>
	/// 排序 
	///</summary>
	[Column("order")]
	public int Order { get; set; } = -1;
	/// <summary>
	/// 图标 
	///</summary>
	[Column("icon")]
	public string? Icon { get; set; }
	/// <summary>
	/// 激活图标 
	///</summary>
	[Column("active_icon")]
	public string? ActiveIcon { get; set; }
	/// <summary>
	/// 更新时间 
	///</summary>
	[Column("update_time")]
	public DateTime UpdateTime { get; set; } = DateTime.Now;
	/// <summary>
	/// 创建时间 
	///</summary>
	[Column("create_time")]
	public DateTime CreateTime { get; set; } = DateTime.Now;

	[NotMapped]
	int IMenu.MenuId => Id;
}
